# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.tools.libtool import LibtoolLibrary


class Recipe(recipe.Recipe):
    name = 'zlib'
    version = '1.2.11'
    stype = SourceType.TARBALL
    btype = BuildType.MESON
    url = 'https://zlib.net/fossils/zlib-%(version)s.tar.gz'
    tarball_checksum = 'c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1'
    licenses = [{License.BSD_like: ['README']}]
    patches = ['zlib/0001-win32-fix-dll-name.patch',
               'zlib/0001-Fix-test-builds-to-use-the-built-libz-headers-librar.patch',
               'zlib/0001-Add-a-meson-port.patch']
    files_libs = ['libz']
    files_devel = ['include/zlib.h', 'include/zconf.h', 'lib/pkgconfig/zlib.pc']

    def post_install(self):
        libtool_la = LibtoolLibrary('z', 1, 2, 11, self.config.libdir,
                self.config.target_platform)
        libtool_la.save()
        super().post_install()
